package com.mz.mattress.client.api.biz;

import com.mz.mattress.api.common.Result;
import com.mz.mattress.api.entity.Banner;
import com.mz.mattress.client.service.BannerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 首页 banner
 */
@RestController
@RequestMapping("/banner")
@Slf4j
public class BannerController {

    @Autowired
    private BannerService bannerService;

    @GetMapping("/list")
    public Result<List<Banner>> list() {
        return bannerService.list();
    }

    @GetMapping("/list2/{name}/{age}")
    public Result list2(@PathVariable(value = "name", required = false) String name, @PathVariable(value = "age", required = false) String age) {
        log.info("name={},age={}", name, age);
        return Result.ok();
    }

}
